package com.mililoan.model.common;

import java.util.ArrayList;

import org.apache.commons.lang3.StringUtils;

import com.mililoan.common.bean.ExtraParam;
import com.mililoan.model.system.Actor;
import com.mililoan.model.system.Function;

public class UserRight extends ExtraParam{
	private ArrayList<Actor>	actors;				// 用户角色
	private String				actorCode;			// 角色编码（标识）==用于根据角色查询用户

	private Integer[]			actorsArr;
	private ArrayList<Integer>	actorCodes;			// 用户角色code
	private ArrayList<String>	actorNames;			// 用户角色name
	
	private String				actorCodesStr;		// 用户角色Str
	private Integer[]			actorCodesArr;
	private String				stringActorNames;
	
	private ArrayList<Function>	funcs;				// 功能列表
	private String[]			funcsArr;			// 功能列表
	private ArrayList<Integer>	funCodes;			// 功能code列表
	private Integer[]			funCodesArr;
	
	public void arrToList() {
		if (null != actorsArr && 0 != actorsArr.length) {
			actors = new ArrayList<Actor>();
			for (Integer actorId : actorsArr) {
				Actor actor = new Actor();
				actor.setId(actorId);
				actors.add(actor);
			}
		}

		if (null != funCodesArr && 0 != funCodesArr.length) {
			funCodes = new ArrayList<Integer>();
			for (Integer funCode : funCodesArr) {
				funCodes.add(funCode);
			}
		}

		if (StringUtils.isNotEmpty(actorCodesStr)) {
			actorCodes = new ArrayList<Integer>();
			for (String actorCode : actorCodesStr.split(",")) {
				actorCodes.add(Integer.parseInt(actorCode));
			}
		}
	}
	
	public String getActorCodesStr() {
		return actorCodesStr;
	}
	public void setActorCodesStr(String actorCodesStr) {
		this.actorCodesStr = actorCodesStr;
	}
	public Integer[] getActorCodesArr() {
		return actorCodesArr;
	}
	public void setActorCodesArr(Integer[] actorCodesArr) {
		this.actorCodesArr = actorCodesArr;
	}
	public String getStringActorNames() {
		return stringActorNames;
	}
	public void setStringActorNames(String stringActorNames) {
		this.stringActorNames = stringActorNames;
	}
	public ArrayList<Function> getFuncs() {
		return funcs;
	}
	public void setFuncs(ArrayList<Function> funcs) {
		this.funcs = funcs;
	}
	public String[] getFuncsArr() {
		return funcsArr;
	}
	public void setFuncsArr(String[] funcsArr) {
		this.funcsArr = funcsArr;
	}
	public ArrayList<Integer> getFunCodes() {
		return funCodes;
	}
	public void setFunCodes(ArrayList<Integer> funCodes) {
		this.funCodes = funCodes;
	}
	public Integer[] getFunCodesArr() {
		return funCodesArr;
	}
	public void setFunCodesArr(Integer[] funCodesArr) {
		this.funCodesArr = funCodesArr;
	}
	public ArrayList<Actor> getActors() {
		return actors;
	}
	public void setActors(ArrayList<Actor> actors) {
		this.actors = actors;
	}
	public Integer[] getActorsArr() {
		return actorsArr;
	}
	public void setActorsArr(Integer[] actorsArr) {
		this.actorsArr = actorsArr;
	}
	public ArrayList<Integer> getActorCodes() {
		return actorCodes;
	}
	public void setActorCodes(ArrayList<Integer> actorCodes) {
		this.actorCodes = actorCodes;
	}
	public ArrayList<String> getActorNames() {
		return actorNames;
	}
	public void setActorNames(ArrayList<String> actorNames) {
		this.actorNames = actorNames;
	}
	public String getActorCode() {
		return actorCode;
	}
	public void setActorCode(String actorCode) {
		this.actorCode = actorCode;
	}
}
